/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
// -*- coding:iso-8859-15 mode: c++ -*-
/** 
 * \file
 * \brief MaCI_CoordinateDrive Player for logged data
 * \author Matthieu Myrsky <matthieu.myrsky@tkk.fi>
 *
 * $Id: CoordinateDriveFilePlayer.hpp,v 1.1 2009-06-24 13:10:49 morsko Exp $
 *
 */
#ifndef _COORDINATEDRIVEFILEPLAYER_HPP_
#define _COORDINATEDRIVEFILEPLAYER_HPP_
#include <string>
#include <map>
#include "PlayerModule.hpp"
#include "owndebug.h"
#include "ownutils.h"
#include "gimutils.h"
#include "CoordinateDriveServer.hpp"

class CoordinateDriveFilePlayer: public PlayerModule
{
public:


  CoordinateDriveFilePlayer(MaCI::CoordinateDrive::CCoordinateDriveServer *aCoordinateDriveServer,
                            std::string aFilename);

  virtual ~CoordinateDriveFilePlayer();


  
  bool GetTimes(std::list<gim::time> *aTimes);

 
  bool OnTime(gim::time aTime);


  std::string GetName(void);

  void GetTimeLimits(gim::time &aBegin,gim::time &aEnd);
private:
  bool ReadData();
  MaCI::CoordinateDrive::CCoordinateDriveServer *iCoordinateDriveServer;
  std::map<gim::time,MaCI::CoordinateDrive::CCoordinateDriveData *> iData;
  std::list<gim::time> iTimes;
  gim::time iBegin;
  gim::time iEnd;
  FILE *iFile;
  std::string iName;

  //*****************************************************************************
  CoordinateDriveFilePlayer(const CoordinateDriveFilePlayer&)
    :PlayerModule(),
     iCoordinateDriveServer(NULL),
     iData(),
     iTimes(),
     iBegin(),
     iEnd(),
     iFile(NULL),
     iName(""){}

  CoordinateDriveFilePlayer &operator=(const CoordinateDriveFilePlayer&) { return *this; }
  //*****************************************************************************
};

#endif
